/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink: 链接地址不为空 2、isIframe:false`
 *      isHide：        是否隐藏此路由
 *      isKeepAlive：   是否缓存组件状态
 *      isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，开启条件，`1、isIframe:true 2、isLink：链接地址不为空`
 *      roles：         当前路由权限标识，取角色管理。控制路由显示、隐藏。超级管理员：admin 普通角色：common
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 定义动态路由
 * @description 未开启 isRequestRoutes 为 true 时使用（前端控制路由），开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
 * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
 * @returns 返回路由菜单数据
 */
import PermissionType from "/@/utils/PermissionType";

export const dynamicRoutes_old = [
	{
		path: '/',
		name: '/',
		component: () => import('/@/layout/index.vue'),
		redirect: '/home',
		meta: {
			isKeepAlive: true,
		},
		children: [
			{
				path: '/home',
				name: 'home',
				component: () => import('/@/views/home/index.vue'),
				meta: {
					title: '首页',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: [PermissionType.sysAdmin],
					icon: 'iconfont icon-shouye',
				},
			},
			{
				path: '/system',
				name: 'system',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/system/menu',
				meta: {
					title: '系统设置',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: [PermissionType.sysAdmin],
					icon: 'iconfont icon-xitongshezhi',
				},
				children: [
					{
						path: '/system/menu',
						name: 'systemMenu',
						component: () => import('/@/views/system/menu/index.vue'),
						meta: {
							title: '菜单管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: [PermissionType.sysAdmin],
							icon: 'iconfont icon-caidan',
						},
					},
					{
						path: '/system/role',
						name: 'systemRole',
						component: () => import('/@/views/system/role/index.vue'),
						meta: {
							title: '角色管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: [PermissionType.sysAdmin],
							icon: 'ele-ColdDrink',
						},
					},
					{
						path: '/system/user',
						name: 'systemUser',
						component: () => import('/@/views/system/user/index.vue'),
						meta: {
							title: '用户管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: [PermissionType.sysAdmin],
							icon: 'iconfont icon-icon-',
						},
					},
					{
						path: '/system/dept',
						name: 'systemDept',
						component: () => import('/@/views/system/dept/index.vue'),
						meta: {
							title: '部门管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: [PermissionType.baseData],
							icon: 'ele-OfficeBuilding',
						},
					},
					{
						path: '/system/dic',
						name: 'systemDic',
						component: () => import('/@/views/system/dic/index.vue'),
						meta: {
							title: '字典管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: [PermissionType.baseData],
							icon: 'ele-SetUp',
						},
					},
				],
			},
		],
	},
];

export const dynamicRoutes = [
	{
		path: '/',
		name: '/',
		component: () => import('/@/layout/index.vue'),
		redirect: '/home',
		meta: {
			isKeepAlive: true,
		},
		children: [
			{
				path: '/home',
				name: 'home',
				component: () => import('/@/views/home/index.vue'),
				meta: {
					title: '首页',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: [PermissionType.sysAdmin],
					icon: 'ele-HomeFilled',
				},
			},
			{
				path: '/sys',
				name: 'SysManagement',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/sys/user',
				meta: {
					title: '系统管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: [PermissionType.sysAdmin],
					icon: 'ele-Setting',
				},
				children: [
					{
						path: '/sys/org',
						name: 'systemOrg',
						component: () => import('/@/views/sys/org/org.vue'),
						meta: {title: '组织架构', isLink: '', isHide: false, isKeepAlive: true, isAffix: false, isIframe: false, roles: [PermissionType.sysAdmin], icon: 'ele-OfficeBuilding',},
					},
					{
						path: '/sys/orguser',
						name: 'systemOrgUser',
						component: () => import('/@/views/sys/org/orguser.vue'),
						meta: {title: '组织用户', isLink: '', isHide: false, isKeepAlive: true, isAffix: false, isIframe: false, roles: [PermissionType.sysAdmin], icon: 'ele-User',},
					},
					{
						path: '/sys/user',
						name: 'systemUser',
						component: () => import('/@/views/sys/user/user.vue'),
						meta: {title: '用户管理', isLink: '', isHide: false, isKeepAlive: true, isAffix: false, isIframe: false, roles: [PermissionType.sysAdmin], icon: 'ele-User',},
					},
					{
						path: '/sys/role',
						name: 'systemRole',
						component: () => import('/@/views/sys/role/role.vue'),
						meta: {title: '角色管理', isLink: '', isHide: false, isKeepAlive: true, isAffix: false, isIframe: false, roles: [PermissionType.sysAdmin], icon: 'ele-ColdDrink',},
					},
				],
			},
			{
				path: '/basedata',
				name: 'baseData',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/basedata/student',
				meta: {
					title: '业务管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: [PermissionType.sysAdmin, PermissionType.baseData],
					icon: 'ele-Notebook',
				},
				children: [
					{
						path: '/basedata/student',
						name: 'basedataStudent',
						component: () => import('/@/views/basedata/student/student.vue'),
						meta: {title: '学生管理', isLink: '', isHide: false, isKeepAlive: true, isAffix: false, isIframe: false, roles: [PermissionType.sysAdmin, PermissionType.baseData_student], icon: 'ele-User',},
					},
					{
						path: '/basedata/studentview/:id',
						name: 'basedataStudentView',
						component: () => import('/@/views/basedata/student/studentView.vue'),
						meta: {title: '学生查看', isHide: true,},
					},
					{
						path: '/basedata/class',
						name: 'basedataClass',
						component: () => import('/@/views/basedata/class/class.vue'),
						meta: {title: '班级管理', isLink: '', isHide: false, isKeepAlive: true, isAffix: false, isIframe: false, roles: [PermissionType.sysAdmin, PermissionType.baseData_class], icon: 'ele-Postcard',},
					},
				],
			},
		],
	},
];

/**
 * 定义404、401界面
 * @link 参考：https://next.router.vuejs.org/zh/guide/essentials/history-mode.html#netlify
 */
export const notFoundAndNoPower = [
	{
		path: '/:path(.*)*',
		name: 'notFound',
		component: () => import('/@/views/error/404.vue'),
		meta: {
			title: '页面找不到',
			isHide: true,
		},
	},
	{
		path: '/401',
		name: 'noPower',
		component: () => import('/@/views/error/401.vue'),
		meta: {
			title: '页面无权限',
			isHide: true,
		},
	},
	{
		path: '/wxcode',
		name: 'wxcode',
		component: () => import('/@/views/wxcode.vue'),
		meta: {
			title: '微信Oauth',
			isHide: true,
		},
	},
];

/**
 * 定义静态路由（默认路由）
 * 此路由不要动，前端添加路由的话，请在 `dynamicRoutes 数组` 中添加
 * @description 前端控制直接改 dynamicRoutes 中的路由，后端控制不需要修改，请求接口路由数据时，会覆盖 dynamicRoutes 第一个顶级 children 的内容（全屏，不包含 layout 中的路由出口）
 * @returns 返回路由菜单数据
 */
export const staticRoutes = [
	{
		path: '/login',
		name: 'login',
		component: () => import('/@/views/login/index.vue'),
		meta: {
			title: '登录',
		},
	},
	{
		path: '/loginhome',
		name: 'loginhome',
		component: () => import('/@/views/login/home.vue'),
		meta: {
			title: '登录',
		},
	},
	{
		path: '/logout',
		name: 'logout',
		component: () => import('/@/views/login/logout.vue'),
		meta: {
			title: '退出',
		},
	},
	{
		path: '/weixin',
		name: 'weixin',
		component: () => import('/@/views/weixin.vue'),
		meta: {title: '企微认证中'}
	},
	{
		path: '/wxcode',
		name: 'wxcode',
		component: () => import('/@/views/wxcode.vue'),
		meta: {title: '企微认证中'}
	},
	{
		path: '/bcweixin',
		name: 'bcweixin',
		component: () => import('/@/views/bcweixin.vue'),
		meta: {title: '企微认证中'}
	},
	{
		path: '/bcwxcode',
		name: 'bcwxcode',
		component: () => import('/@/views/bcwxcode.vue'),
		meta: {title: '企微认证中'}
	},
];
